package com.skyme.automation.generate.wizard.bpm;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

public class BpmSelectWizardPage extends WizardPage {

	// 选择的工作流类型
	private String bpmType;

	/**
	 * Create the wizard.
	 */
	public BpmSelectWizardPage() {
		super("wizardPage");
		setTitle("选择工作流");
		setDescription("请选择要添加的工作流框架");

		// 只有选择才能点击完成
		setPageComplete(false);
	}

	/**
	 * Create contents of the wizard.
	 * 
	 * @param parent
	 */
	public void createControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NULL);

		setControl(container);
		container.setLayout(new GridLayout(2, false));

		Label label = new Label(container, SWT.NONE);
		label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false,
				1, 1));
		label.setText("请选择要添加的工作流类型：");

		final Combo combo = new Combo(container, SWT.NONE);
		combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

		combo.add("jbpm4.4");
		combo.add("Activilti");

		combo.addSelectionListener(new SelectionAdapter() {

			@Override
			public void widgetSelected(SelectionEvent e) {
				String selectValue = combo.getText();
				bpmType = selectValue;
				setPageComplete(true);
			}

		});
		
	}

	public String getBpmType() {
		return bpmType;
	}

}
